package com.trsjh.db.domains;
// Generated 2012-1-13 12:55:11 by Hibernate Tools 3.4.0.CR1


import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;

/**
 * CustomerAccount generated by hbm2java
 */
@Entity
@Table(name="customerAccounts"
    ,catalog="myglass"
    , uniqueConstraints = { @UniqueConstraint(columnNames={"loginName", "customer"})} 
)
public class CustomerAccount  implements java.io.Serializable {

	@Id @GeneratedValue(strategy=IDENTITY)
   @Column(name="id", unique=true, nullable=false)
     private Integer id;
     /**
      * 父帐号
      */
    @ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="customer", nullable=false,updatable=true)
     private Customer customer;
     /**
      * 子帐号真实姓名
      */
    @Column(name="name", length=45)
     private String name;
     /**
      * 子帐号登录名
      */
    @Column(name="loginName", unique=true, length=45)
     private String loginName;
     /**
      * 子帐号登陆密码
      */
    @Column(name="password", nullable=false, length=45)
     private String password;
     /**
      * 注册时间
      */

    @Temporal(TemporalType.DATE)
    @Column(name="registerTime", length=10)
     private Date registerTime;
     /**
      * 性别
      * m：male
      * f:female
      */

    @Column(name="sex", length=1)
     private Character sex;
     /**
      * 生日
      */

    @Temporal(TemporalType.DATE)
    @Column(name="birthday", length=10)
     private Date birthday;
     /**
      * 最后一次左眼视力
      */
    
    @Column(name="leftSight", precision=12, scale=0)
     private Float leftSight;
     /**
      * 最后一次右眼视力
      */
    
    @Column(name="rightSight", precision=12, scale=0)
     private Float rightSight;
     /**
      * 最后一次左眼散光视力
      */
    
    @Column(name="leftSight2", precision=12, scale=0)
     private Float leftSight2;
     /**
      * 最后一次右眼散光视力
      */
    
    @Column(name="rightSight2", precision=12, scale=0)
     private Float rightSight2;
     /**
      * 瞳距
      */
    @Column(name="distance", precision=12, scale=0)
    private Float distance;
     /**
      * 总消费金额
      */
    @Column(name="totalMoney", precision=9)
     private BigDecimal totalMoney;
     /**
      * 备注
      */
    @Column(name="note", length=200)
     private String note;
    @Column(name="email", length=100,nullable=true)
    private String email;
    @Column(name="tel", length=20,nullable=true)
    private String tel;
    @Column(name="totalScore")
    private Float totalScore=0f;
    @Column(name="leftScore")
    private Float leftScore=0f;
    
   
//    /**
//     * 子帐号的订单
//     */
//    @OneToMany(fetch=FetchType.LAZY, mappedBy="customerAccount")
//     private Set<Order> orders = new HashSet<Order>(0);
     /**
      * 子帐号的视力记录
      */
  @OneToMany(fetch=FetchType.LAZY, mappedBy="customerAccount")
     private Set<CustomerRecord> customerRecords = new HashSet<CustomerRecord>(0);

    public CustomerAccount() {
    }

	
    public CustomerAccount(Customer customer, String password) {
        this.customer = customer;
        this.password = password;
    }

    public CustomerAccount(Customer customer, String name, String loginName,
			String password, Date registerTime, Character sex, Date birthday,
			Float leftSight, Float rightSight, Float leftSight2,
			Float rightSight2, Float distance, BigDecimal totalMoney,
			String note, String email, String tel,
			Set<CustomerRecord> customerRecords,Float totalScore,Float leftScore) {
		super();
		this.customer = customer;
		this.name = name;
		this.loginName = loginName;
		this.password = password;
		this.registerTime = registerTime;
		this.sex = sex;
		this.birthday = birthday;
		this.leftSight = leftSight;
		this.rightSight = rightSight;
		this.leftSight2 = leftSight2;
		this.rightSight2 = rightSight2;
		this.distance = distance;
		this.totalMoney = totalMoney;
		this.note = note;
		this.email = email;
		this.tel = tel;
		this.customerRecords = customerRecords;
		this.totalScore=totalScore;
		this.leftScore=leftScore;
	}


	public CustomerAccount(Customer customer, String name, String loginName, String password, Date registerTime, Character sex, Date birthday, Float leftSight, Float rightSight, Float leftSight2, Float rightSight2, Float distance, BigDecimal totalMoney, String note) {
        this.customer = customer;
        this.name = name;
        this.loginName = loginName;
        this.password = password;
        this.registerTime = registerTime;
        this.sex = sex;
        this.birthday = birthday;
        this.leftSight = leftSight;
        this.rightSight = rightSight;
        this.leftSight2 = leftSight2;
        this.rightSight2 = rightSight2;
        this.distance = distance;
        this.totalMoney = totalMoney;
        this.note = note;
     }
    public Integer getId() {
        return this.id;
    }
    
    public void setId(Integer id) {
        this.id = id;
    }

    
    
    public String getName() {
        return this.name;
    }
    
    public void setName(String name) {
        this.name = name;
    }

    

    public String getLoginName() {
        return this.loginName;
    }
    
    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public String getPassword() {
        return this.password;
    }
    
    public void setPassword(String password) {
        this.password = password;
    }
    public Date getRegisterTime() {
        return this.registerTime;
    }
    
    public void setRegisterTime(Date registerTime) {
        this.registerTime = registerTime;
    }

    public Character getSex() {
        return this.sex;
    }
    
    public void setSex(Character sex) {
        this.sex = sex;
    }
    public Date getBirthday() {
        return this.birthday;
    }
    
    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public Float getLeftSight() {
        return this.leftSight;
    }
    
    public void setLeftSight(Float leftSight) {
        this.leftSight = leftSight;
    }

    public Float getRightSight() {
        return this.rightSight;
    }
    
    public void setRightSight(Float rightSight) {
        this.rightSight = rightSight;
    }

    public Float getLeftSight2() {
        return this.leftSight2;
    }
    
    public void setLeftSight2(Float leftSight2) {
        this.leftSight2 = leftSight2;
    }

    public Float getRightSight2() {
        return this.rightSight2;
    }
    
    public void setRightSight2(Float rightSight2) {
        this.rightSight2 = rightSight2;
    }

    public Float getDistance() {
        return this.distance;
    }
    
    public void setDistance(Float distance) {
        this.distance = distance;
    }

    public BigDecimal getTotalMoney() {
        return this.totalMoney;
    }
    
    public void setTotalMoney(BigDecimal totalMoney) {
        this.totalMoney = totalMoney;
    }

    public String getNote() {
        return this.note;
    }
    
    public void setNote(String note) {
        this.note = note;
    }


	public Customer getCustomer() {
		return customer;
	}


	public void setCustomer(Customer customer) {
		this.customer = customer;
	}


	public String getEmail() {
		return email;
	}


	public void setEmail(String email) {
		this.email = email;
	}


	public String getTel() {
		return tel;
	}


	public void setTel(String tel) {
		this.tel = tel;
	}


	public Set<CustomerRecord> getCustomerRecords() {
		return customerRecords;
	}


	public void setCustomerRecords(Set<CustomerRecord> customerRecords) {
		this.customerRecords = customerRecords;
	}


	public Float getTotalScore() {
		return totalScore;
	}


	public void setTotalScore(Float totalScore) {
		this.totalScore = totalScore;
	}


	public Float getLeftScore() {
		return leftScore;
	}


	public void setLeftScore(Float leftScore) {
		this.leftScore = leftScore;
	}
	
	
}


